package com.cash.app.utils

import android.content.Context
import com.adjust.sdk.Adjust
import com.adjust.sdk.AdjustConfig
import com.adjust.sdk.LogLevel
import com.cash.app.BuildConfig
import com.cash.app.constant.AppConstant

object GPAdjust {

    private const val TAG = "GPAdjust"
    fun init(context: Context) {
        val appToken = BuildConfig.ADJUST_ID
        val environment = if (BuildConfig.DEBUG) {  // debug
            AdjustConfig.ENVIRONMENT_SANDBOX
        } else { // release
            AdjustConfig.ENVIRONMENT_PRODUCTION
        }
        val config = AdjustConfig(context, appToken, environment)
        config.setLogLevel(LogLevel.VERBOSE)
        Adjust.initSdk(config)
        Adjust.getAdid { adjustId ->
            SpUtils.put(AppConstant.K_AJ_ID, adjustId)
            TLog.i("adjustId=$adjustId", TAG)
        }
    }
}